package com.yousu.wxqropendoor.controller;


import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yousu.wxqropendoor.entity.ManageBuilding;
import com.yousu.wxqropendoor.service.IManageBuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author cwb
 * @since 2020-02-28
 */
@RestController
@RequestMapping("/manage-building")
public class ManageBuildingController {
    @Autowired
    IManageBuildingService manageBuildingService;

    /**
     * 按community_id和status查询
     *
     * @return List<ManageBuilding> JSON
     */
    @GetMapping("/list")
    public Object list(
            @RequestParam(value = "community_id") Integer communityId,
            @RequestParam(value = "status") Integer status) {
        QueryWrapper<ManageBuilding> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("community_id", communityId);
        queryWrapper.eq("status", status);
        List<ManageBuilding> list = manageBuildingService.list(queryWrapper);
        return list;
    }

}

